module TraitsHelper
  def list_trait_effects (trait)
    list = ""
    for attr in TraitEffect.character_attributes
      modifier = trait.total_modifier attr
      if modifier > 0
        list += "<li>#{attr} +#{modifier}</li>"
      elsif modifier < 0
        list += "<li>#{attr} #{modifier}</li>"
      end
    end
    for attr in TraitEffect.special_cases
      if trait.special_case? attr
        list += "<li>#{attr}</li>"
      end
    end
    return list
  end
  
  def options_trait_categories (selected=0)
    options_hash_select Trait.categories, selected
  end
  
  def options_traits (selected="")
    options_records_select Trait.find(:all), selected
  end
end
